<!-- @format -->

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<script>
			// 1. 声明一个变量per, 类型为对象类型
			// 2. 该对象的属性为性别,年龄,爱好(3个)
			// 3. 该对象的方法有 说话, 吃饭(2个)
			// 4. 在控制台分别调用该对象的属性和方法
			let per = {
				gender: "男",
				age: 18,
				hobby: "打游戏",
				speak: function () {
					document.write(`我的爱好是：${this.hobby}`);
				},
				eat: function () {
					document.write(`我正在吃饭`);
				},
			};
			document.write(per.gender + " ");
			document.write(per.age + " ");
			document.write(per.hobby + " ");
			per.speak();
			document.write(" ");
			per.eat();
		</script>
	</body>
</html>
